package com.mbc.hr.entities;

import java.util.Date;
import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Entity
@Table(name="HR_ApprovedLeave")
@NamedQueries({
	@NamedQuery(name="ApprovedLeave.findAll", query="SELECT l FROM ApprovedLeave l"),
	@NamedQuery(name="ApprovedLeave.getTotalLeavePerMonth", query="SELECT SUM(l.totalDays) FROM ApprovedLeave l WHERE l.status = :status and (l.startDateTime >= :startDateTime and l.endDateTime <= :endDateTime And l.leaveTypeID = :leaveTypeID and l.employeeID = :employeeID) "),
	@NamedQuery(name="ApprovedLeave.findOverlapped",query="SELECT l FROM ApprovedLeave l WHERE l.employeeID = :employeeID AND l.status = :status AND ((l.startDateTime >= :startDateTime AND l.startDateTime <= :endDateTime) OR (l.endDateTime >= :startDateTime AND l.endDateTime <= :endDateTime))"),
	@NamedQuery(name="ApprovedLeave.findByEventID", query = "SELECT l FROM ApprovedLeave l WHERE l.eventID = :eventID"),
	@NamedQuery(name="ApprovedLeave.findBetween", query="SELECT l from ApprovedLeave l WHERE l.employeeID = :employeeID AND l.status = :status AND ((l.startDateTime >= :startDateTime AND l.startDateTime <= :endDateTime) OR (l.endDateTime >= :startDateTime AND l.endDateTime <= :endDateTime))")
})
public class ApprovedLeave implements Serializable {

	@Id
	private Long leaveID;
	private Long eventID;
	private Long createdBy;
	private Date createdDate;
	private long employeeID;
	private String reason;
	private Date startDateTime;
	private Date endDateTime;
	private Double totalDays;
	private Long approvedBy;
	private Date approvedDate;
	private long leaveTypeID;
	private byte status;
	private String comment;
	private String leaveDescription;
	private String employeeName;
	private byte leavePeriodType;

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public Date getApprovedDate() {
		return approvedDate;
	}

	public void setApprovedDate(Date approvedDate) {
		this.approvedDate = approvedDate;
	}
	
	public Long getLeaveID(){
		return leaveID;
	}

	public void setLeaveID(Long leaveID){
		this.leaveID = leaveID;
	}

	public Long getEventID(){
		return eventID;
	}

	public void setEventID(Long eventID){
		this.eventID = eventID;
	}

	public Long getCreatedBy(){
		return createdBy;
	}

	public void setCreatedBy(Long createdBy){
		this.createdBy = createdBy;
	}

	public String getReason(){
		return reason;
	}

	public void setReason(String event){
		this.reason = event;
	}

	public Date getStartDateTime(){
		return startDateTime;
	}

	public void setStartDateTime(Date startDateTime){
		this.startDateTime = startDateTime;
	}

	public Date getEndDateTime(){
		return endDateTime;
	}

	public void setEndDateTime(Date endDateTime){
		this.endDateTime = endDateTime;
	}

	public Double getTotalDays(){
		return totalDays;
	}

	public void setTotalDays(Double totalDays){
		this.totalDays = totalDays;
	}

	public Long getApprovedBy(){
		return approvedBy;
	}

	public void setApprovedBy(Long approvedBy){
		this.approvedBy = approvedBy;
	}

	public long getLeaveTypeID(){
		return leaveTypeID;
	}

	public void setLeaveTypeID(long leaveTypeID){
		this.leaveTypeID = leaveTypeID;
	}

	public String getEmployeeName() {
		return employeeName;
	}

	public void setEmployeeName(String employeeName) {
		this.employeeName = employeeName;
	}

	public long getEmployeeID() {
		return employeeID;
	}

	public void setEmployeeID(long employeeID) {
		this.employeeID = employeeID;
	}

	public byte getStatus() {
		return status;
	}

	public void setStatus(byte status) {
		this.status = status;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getLeaveDescription() {
		return leaveDescription;
	}

	public void setLeaveDescription(String leaveDescription) {
		this.leaveDescription = leaveDescription;
	}

	public byte getLeavePeriodType() {
		return leavePeriodType;
	}

	public void setLeavePeriodType(byte leavePeriodType) {
		this.leavePeriodType = leavePeriodType;
	}


}
